<link rel="stylesheet" href="/js/jquery-confirm/jquery-confirm.min.css">
<link rel="stylesheet" href="/css/tableStyle.css">
<link rel="stylesheet" href="/css/element-ui/lib/theme-chalk/index.css">
<link rel="stylesheet" href="/css/element-ui/lib/theme-chalk/theme.css">

<div id="shopOrderList">
    <div class="order-top-view">
        <button class="btn btn-dropbox" v-on:click="searchFormShow = !searchFormShow">
            <i class="fa fa-filter"></i><span class="hidden-xs">筛选</span>
        </button>
        <!-- 订单状态 -->
        <div class="ycxq-tabs">
            <p :class="['tab-item', { 'active': statusActive == item.value }]" v-for="(item, index) in statusOptions"
               :key="index" v-on:click="changeTab(item)">
                @{{ item.name }}
                <span v-if="item.showCount">(@{{ item.count }})</span>
            </p>
        </div>
    </div>
    <!-- 筛选项 -->
    <div class="search-form" v-show="searchFormShow">
    <el-form :inline="true" 
             :model="searchForm" 
             size="mini"
             label-width="115px"
             class="order-form-inline">
        <el-form-item label="订单号：">
            <el-input v-model="searchForm.serialNumber" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="运单号：">
            <el-input v-model="searchForm.expressNo" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="商品id：">
            <el-input v-model="searchForm.productId" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="下单人手机号：">
            <el-input v-model="searchForm.userMobile" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="收件人姓名：">
            <el-input v-model="searchForm.orderContacts" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="收件人手机号：">
            <el-input v-model="searchForm.orderContactsMobile" placeholder="请输入"></el-input>
        </el-form-item>
        <el-form-item label="时间筛选：">
        <el-date-picker
            v-model="searchForm.date"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
            </el-date-picker>
        </el-form-item>
        <el-form-item style="width:100%;padding-left: 115px;">
            <el-button type="primary" icon="el-icon-search" v-on:click="getList('change')">搜索</el-button>
            <el-button icon="el-icon-refresh-left" v-on:click="onReset()">重置</el-button>
        </el-form-item>
    </el-form>
    </div>
    <!-- 列表 -->
    <div class="table-responsive">
        <table class="table table-bordered ycxq-order-table">
            <thead>
            <tr>
                <th scope="col">ID</th>
                <th scope="col">订单号</th>
                <th scope="col">图片</th>
                <th scope="col">商品信息</th>
                <th scope="col">原价</th>
                <th scope="col">运费</th>
                <th scope="col">总金额</th>
                <th scope="col">状态</th>
                <th scope="col">捡漏订单</th>
                <th scope="col">收货信息</th>
                <th scope="col">用户备注</th>
                <th scope="col">物流信息</th>
                <th scope="col">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item, index) in list" :key="index">
                <th scope="row">@{{ item.order_id }}</th>
                <td>
                    <div>
                        <p>@{{ item.serial_number }}</p>
                        <p style="margin-top:6px;">@{{ item.createdAt }}</p>
                    </div>
                </td>
                <td>
                    <div class="goods-img" v-for="good in item?.goods" :key="good.product_file_id">
                        <img :src="getGoodsImgUrl(good.product_file_id)" />
                    </div>
                </td>
                <td>
                    <div class="goods-list" v-for="good in item?.goods" :key="good.product_file_id">
                        <p>@{{ good.title }}</p>
                        <p style="margin-top:6px;">
                            <span>规格：@{{ good.spec }}</span>
                            <span>数量：@{{ good.quantity }}</span>
                        </p>
                    </div>
                </td>
                <td>
                    <div class="goods-price" v-for="good in item?.goods" :key="good.product_file_id">
                        ￥@{{ good.price }}
                    </div>
                </td>
                <td>
                    ￥@{{ item.ext.freight || 0 }}
                </td>
                <td>
                    ￥@{{ item.pay_price }}
                </td>
                <td>
                    @{{ statusOptions.find(v => v.value == item.status)?.name }}
                </td>
                <td>
                    @{{ item?.plug>0 || item?.plug2>0 ? '是' : '否' }}
                </td>
                <td>
                    <div v-if="item.order_is_self_pickup == 1">
                        自提订单
                    </div>
                    <div v-else>
                        <p>
                            <span>@{{ item.order_contacts }}</span>
                            <span style="margin-left:5px;">@{{ item.order_contacts_mobile }}</span>
                        </p>
                        <p style="margin-top:6px;">@{{ item.order_contacts_address }}</p>
                    </div>
                </td>
                <td>
                    @{{ item.order_note || '' }}
                </td>
                <td>
                    <div v-if="item.order_is_self_pickup == 1 || !item.packages.length">
                        无
                    </div>
                    <div v-else>
                        <div class="goods-price" v-for="package in item?.packages" :key="package.serial_number"
                             style="display:flex;">
                            <span>@{{ package.express_no }}</span>
                            <i class="fa fa-eye" style="margin-left:5px;"
                               v-on:click="onListRow(package, '物流信息')"></i>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="btn-group">
                        <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"
                                aria-haspopup="true" aria-expanded="false" style="color: #fff !important;">
                            操作 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" v-if="!['7','8'].includes(statusActive)">
                            <li v-on:click="onListRow(item, '查看详情')"><a href="#">查看详情</a></li>
                            <li v-on:click="onListRow(item, '订单发货')" v-if="item.status<5"><a href="#">订单发货</a>
                            </li>
                            <li v-on:click="onListRow(item, '修改收货信息')" v-if="item.status<5"><a
                                    href="#">修改收货信息</a></li>
                            <li v-on:click="onListRow(item, '卖家备注')"><a href="#">卖家备注</a></li>
                        </ul>
                        <!-- 售后中按钮 -->
                        <ul class="dropdown-menu" v-else>
                            <li v-on:click="onListRow(item, '先退货')" v-if="statusActive == '7'"><a
                                    href="#">先退货</a></li>
                            <li v-on:click="onListRow(item, '取消退货')" v-if="statusActive == '8'"><a
                                    href="#">取消退货</a></li>
                            <li v-on:click="onListRow(item, '退款')"><a href="#">退款</a></li>
                            <li v-on:click="onListRow(item, '拒绝')"><a href="#">拒绝</a></li>
                        </ul>

                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <p class="ycxq-list-empty" v-if="!list.length">暂无数据</p>
    </div>
    <!-- 分页 -->
    <div id="page" class="ycxq-paging"></div>
    <!-- 操作弹窗 -->
    <div class="modal fade" tabindex="-1" role="dialog" id="seller-order-modal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">@{{ modalForm.title }}</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal" role="form">
                        <div class="form-group" v-if="modalForm.type == 1">
                            <label class="col-sm-2 control-label">快递单号：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" placeholder="请输入快递单号"
                                       v-model="modalForm.logisticNo">
                            </div>
                        </div>
                        <div v-if="modalForm.type == 2">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">收货人：</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" placeholder="请输入"
                                           v-model="modalForm.deliveryInfo.name">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">收货人电话：</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" placeholder="请输入"
                                           v-model="modalForm.deliveryInfo.mobile">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">收货人地址：</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" placeholder="请输入"
                                           v-model="modalForm.deliveryInfo.address">
                                </div>
                            </div>
                        </div>
                        <div class="form-group" v-if="modalForm.type == 3">
                            <label class="col-sm-2 control-label">商家备注：</label>
                            <div class="col-sm-10">
                                <textarea rows="5" class="form-control" placeholder="请输入商家备注" v-model="modalForm.sellerRemark"></textarea>
                            </div>
                        </div>
                        <div v-if="modalForm.type == 7">
                            <div class="detail-msg-item">
                                <span>订单号：</span>
                                <span>@{{ modalForm.row.serial_number }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>自提：</span>
                                <span>@{{ modalForm.row.order_is_self_pickup == 1 ? '是' : '否' }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>支付时间：</span>
                                <span>@{{ modalForm.row.ext.pay_at }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>发货时间：</span>
                                <span>@{{ modalForm.row.ext.deliver_at }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>保费：</span>
                                <span>@{{ modalForm.row.order_ensure_price }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>订单金额：</span>
                                <span>@{{ modalForm.row.order_total_real_price }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>用户备注：</span>
                                <span>@{{ modalForm.row.order_note }}</span>
                            </div>
                            <div class="detail-msg-item">
                                <span>商家备注：</span>
                                <span>@{{ modalForm.row.seller_remark }}</span>
                            </div>
                        </div>
                        <div class="ycxq-deliver-info" v-if="modalForm.type == 8">
                            <div class="content-item" v-if="!modalForm.logisticInfo?.info">
                                <div class="deliver-no" style="display: flex;justify-content: space-between;align-items: center;">
                                    <span class="no-title">物流单号：@{{ modalForm.logisticInfo?.expressNo || modalForm.logisticInfo?.express_no }}</span>
                                    <button type="button" class="btn btn-success" v-on:click="onListRow(modalForm.logisticInfo, '修改物流')">修改</button>
                                </div>
                                <div class="deliver-timeline">
                                    <div class="deliver-no" style="margin-bottom: 50px;color: #999;">
                                        @{{ modalForm.logisticInfo?.message || '暂无物流信息~' }}</div>
                                </div>
                            </div>
                            <div class="content-item" v-else>
                                <div class="deliver-no" style="display: flex;justify-content: space-between;align-items: center;">
                                    <span class="no-title">物流单号：@{{ modalForm.logisticInfo?.express_no }}</span>
                                    <button type="button" class="btn btn-success"v-on:click="onListRow(modalForm.logisticInfo, '修改物流')">修改</button>
                                </div>
                                <div class="deliver-timeline">
                                    <div class="deliver-timeline-item"
                                         v-for="(item, index) in modalForm.logisticInfo?.info?.data"
                                         :key="index">
                                        <span class="item-dot"></span>
                                        <div class="item-content">
                                            <p>@{{ item.context }}</p>
                                            <h4>@{{ item.time }}</h4>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" v-if="modalForm.type == 9">
                            <label class="col-sm-3 asterisk control-label">选择退货地址：</label>
                            <div class="col-sm-9">
                                <el-select size="small" clearable style="width: 100%;"
                                           v-model="modalForm.refundAddress">
                                    <el-option v-for="item in modalForm.addressList" :key="item.id"
                                               :label="item.address" :value="item.id" />
                                </el-select>
                            </div>
                        </div>
                        <div class="form-horizontal" role="form" v-if="modalForm.type == 10">
                            <div class="form-group">
                                <label class="col-sm-3 asterisk control-label">选择退款类型：</label>
                                <div class="col-sm-9">
                                    <el-select size="small" clearable style="width: 100%"
                                               v-model="modalForm.refundType">
                                        <el-option v-for="item in modalForm.refundTypeList" :key="item.id"
                                                   :label="item.label" :value="item.id" />
                                    </el-select>
                                </div>
                            </div>
                            <div class="form-group" v-if="modalForm.refundType == 0">
                                <label class="col-sm-3 asterisk control-label">退款金额：</label>
                                <div class="col-sm-9">
                                    <el-input size="small" type="number" style="width: 100%"
                                              :placeholder="'本单金额：' + modalForm.row?.order_total_real_price"
                                              v-model="modalForm.refundMoney" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-success" v-on:click="modalConfirm">确认</button>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/js/vue/vue-2.7.js"></script>
<script src="/js/element-ui/lib/index.js"></script>
<script src="/js/pagination/paging.js"></script>
<script src="/js/jquery-confirm/jquery-confirm.min.js"></script>
<script src="/js/utils/ajaxFunc.js?timestamp=1731402984439"></script>
<script>
    const newAuth = '{{ $newAuth }}';
    const ossPrefix = '{{ config('oss.url') }}';

    $(function() {
        let orderListVm = new Vue({
            el: '#shopOrderList',
            data: {
                page: 1,
                limit: 10,
                totalPage: 0,
                list: [],
                // 订单状态
                statusOptions: [{
                    name: '待发货',
                    value: '2',
                    showCount: true,
                    count: 0
                }, {
                    name: '待收货',
                    value: '3',
                    showCount: true,
                    count: 0
                }, {
                    name: '待付款',
                    value: '1',
                    showCount: true,
                    count: 0
                }, {
                    name: '已完成',
                    value: '4',
                    showCount: true,
                    count: 0
                }, {
                    name: '已退款',
                    value: '5',
                    showCount: true,
                    count: 0
                }, {
                    name: '已退货',
                    value: '6',
                    showCount: true,
                    count: 0
                },
                    //     {
                    //     name: '退货中',
                    //     value: '8',
                    //     showCount: true,
                    //     count: 0
                    // }, {
                    //     name: '售后中',
                    //     value: '7',
                    //     showCount: true,
                    //     count: 0
                    // }
                ],
                statusActive: '2',
                modalForm: {
                    title: '',
                    // 1:发货，2：修改发货信息，3：卖家备注  7：详情   8：查看物流 9:退货选择地址 10：退款弹框
                    type: '',
                    row: {},
                    logisticInfo: {},
                    logisticNo: '',
                    deliveryInfo: {
                        name: '',
                        mobile: '',
                        address: ''
                    },
                    sellerRemark: '',
                    addressList: [],
                    refundAddress: '',
                    refundTypeList: [{
                        id: 0,
                        label: '部分退款'
                    },
                        {
                            id: 1,
                            label: '全额退款'
                        }
                    ],
                    refundType: 0,
                    refundMoney: ''
                },
                searchFormShow: false,
                searchForm: {
                    serialNumber: '',
                    userMobile: '',
                    orderContacts: '',
                    orderContactsMobile: '',
                    productId: '',
                    expressNo: '',
                    date: ''
                }
            },
            methods: {
                getGoodsImgUrl(path) {
                    return getImgUrlFunc(path, ossPrefix)
                },
                changeTab(row) {
                    if (orderListVm.statusActive != row.value) {
                        orderListVm.statusActive = row.value
                        orderListVm.getTJ()
                        orderListVm.getList('change')
                    }
                },
                onReset(val) {
                    this.searchForm = {
                        serialNumber: '',
                        userMobile: '',
                        orderContacts: '',
                        orderContactsMobile: '',
                        productId: '',
                        expressNo: '',
                        date: ''
                    }
                    if(!val) this.getList('change')
                },
                onListRow(row, type) {
                    orderListVm.modalForm.logisticNo = ''
                    orderListVm.modalForm.deliveryInfo = {
                        name: '',
                        mobile: '',
                        address: ''
                    }
                    orderListVm.modalForm.sellerRemark = ''

                    if (type == '查看详情') {
                        // window.location.href = '/admin/shopOrder/' + row.order_id
                        orderListVm.modalForm.title = '订单详情'
                        orderListVm.modalForm.type = 7
                        orderListVm.modalForm.row = row

                        $('#seller-order-modal').modal('show');
                    } else if (type == '订单发货') {
                        orderListVm.modalForm.title = '订单发货'
                        orderListVm.modalForm.type = 1
                        orderListVm.modalForm.row = row

                        $('#seller-order-modal').modal('show');
                    } else if (type == '修改收货信息') {
                        orderListVm.modalForm.title = '修改收货信息'
                        orderListVm.modalForm.type = 2
                        orderListVm.modalForm.row = row
                        orderListVm.modalForm.deliveryInfo = {
                            name: row.order_contacts,
                            mobile: row.order_contacts_mobile,
                            address: row.order_contacts_address
                        }

                        $('#seller-order-modal').modal('show');
                    } else if (type == '卖家备注') {
                        orderListVm.modalForm.title = '卖家备注'
                        orderListVm.modalForm.type = 3
                        orderListVm.modalForm.row = row
                        orderListVm.modalForm.sellerRemark = row.seller_remark

                        $('#seller-order-modal').modal('show');
                    } else if (type == '物流信息') {
                        orderListVm.modalForm.title = '物流信息'
                        orderListVm.modalForm.type = 8
                        orderListVm.modalForm.row = row

                        ajaxPostFunc('/v1/api/logistic/logisticInfo', {
                            serialNumber: row.serial_number
                        }, {
                            'newAuth': newAuth
                        }, res => {
                            orderListVm.modalForm.logisticInfo = res
                            $('#seller-order-modal').modal('show');
                        })
                    } else if (type === '先退货') {
                        orderListVm.modalForm.title = '选择退货地址'
                        orderListVm.modalForm.type = 9
                        orderListVm.modalForm.row = row
                        ajaxPostFunc('/v1/api/productOrderReturn/sellerAddressList', {}, {
                            'newAuth': newAuth
                        }, res => {
                            orderListVm.modalForm.addressList = res.map(item => ({
                                id: item.ua_id,
                                address: item.ua_address_full
                            }))
                            $('#seller-order-modal').modal('show');
                        })
                    } else if (type === '退款') {
                        orderListVm.modalForm.title = '退款'
                        orderListVm.modalForm.type = 10
                        orderListVm.modalForm.row = row
                        orderListVm.modalForm.refundType = 0
                        orderListVm.modalForm.refundMoney = ''
                        $('#seller-order-modal').modal('show');
                    } else if (type === '拒绝') {
                        this.$confirm('确认拒绝该订单退款?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            const params = {
                                serialNumber: row?.order_return?.serial_number,
                                status: 2
                            }
                            this.returnHandleApi(params, 'refundAudit')
                        })
                    } else if (type === '取消退货') {
                        this.$confirm('确认取消退货吗?', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            this.returnHandleApi({
                                serialNumber: row?.order_return?.serial_number
                            }, 'cancelRefund')
                        })
                    } else if (type === '修改物流') {
                        $('#seller-order-modal').modal('hide');
                        this.$prompt('请输入物流单号', '修改物流信息', {
                            confirmButtonText: '提交',
                            cancelButtonText: '取消',
                            inputValue: row.expressNo,
                            inputPattern: /\S/,
                            inputErrorMessage: '物流单号不能为空'
                        }).then(({ value }) => {
                            ajaxPostFunc('/v1/api/logistic/edit', {
                                serialNumber: orderListVm.modalForm.row.serial_number,
                                expressNo: value
                            }, {
                                'newAuth': newAuth
                            }, res => {
                                this.$message({
                                    message: '修改成功',
                                    type: 'success'
                                });
                                orderListVm.getList()
                            })
                        })
                    }
                },
                getTJ() {
                    ajaxPostFunc('/v1/api/productOrder/extTj', {}, {
                        'newAuth': newAuth
                    }, res => {
                        // console.log(res);
                        orderListVm.statusOptions[0].count = res['2'] || 0
                        orderListVm.statusOptions[1].count = res['3'] || 0
                        orderListVm.statusOptions[2].count = res['1'] || 0
                        orderListVm.statusOptions[3].count = res['4'] || 0
                        orderListVm.statusOptions[4].count = res['5'] || 0
                        orderListVm.statusOptions[6].count = res['8'] || 0
                        orderListVm.statusOptions[7].count = res['7'] || 0
                    })
                },
                getList(val) {
                    if (val) {
                        orderListVm.page = 1
                        orderListVm.list = []
                    }

                    let postParams = {
                        'shopOrderExt.status': orderListVm.statusActive,
                        page: orderListVm.page,
                        limit: orderListVm.limit
                    }
                    if(this.searchForm.serialNumber) postParams.serialNumber = this.searchForm.serialNumber
                    if(this.searchForm.userMobile) postParams.userMobile = this.searchForm.userMobile
                    if(this.searchForm.orderContacts) postParams.orderContacts = this.searchForm.orderContacts
                    if(this.searchForm.orderContactsMobile) postParams.orderContactsMobile = this.searchForm.orderContactsMobile
                    if(this.searchForm.productId) postParams.productId = this.searchForm.productId
                    if(this.searchForm.expressNo) postParams.expressNo = this.searchForm.expressNo
                    if(this.searchForm.date.length) {
                        postParams.startAt = timestampToDay(this.searchForm.date[0])+' '+'00:00:00'
                        postParams.endAt = timestampToDay(this.searchForm.date[1])+' '+'23:59:59'
                    }

                    ajaxPostFunc('/v1/api/productOrder/paging', postParams, {
                        'newAuth': newAuth
                    }, res => {
                        orderListVm.list = res.data
                        orderListVm.totalPage = res.totalPage

                        $('#page').paging({
                            total: res.total,
                            numberPage: orderListVm.limit,
                            activePage: parseInt(orderListVm.page)
                        }, function(msg) {
                            if (msg != orderListVm.page) {
                                orderListVm.page = parseInt(msg)
                                orderListVm.getList()
                            }
                        })
                    })
                },
                modalConfirm() {
                    if (orderListVm.modalForm.type == 1) {
                        let {
                            logisticNo
                        } = orderListVm.modalForm
                        if (!logisticNo) return $.alert('请输入物流单号')
                        orderListVm.tableHandleApi({
                            'name': 'deliver',
                            'expressNo': logisticNo
                        })
                    } else if (orderListVm.modalForm.type == 2) {
                        let {
                            name,
                            mobile,
                            address
                        } = orderListVm.modalForm.deliveryInfo
                        if (!name || !mobile || !address) return $.alert('请输入完整')
                        orderListVm.tableHandleApi({
                            'name': 'editReceiverInfo',
                            'contacts': name,
                            'mobile': mobile,
                            'address': address
                        })
                    } else if (orderListVm.modalForm.type == 3) {
                        let {
                            sellerRemark
                        } = orderListVm.modalForm
                        if (!sellerRemark) return $.alert('请输入备注信息')
                        orderListVm.tableHandleApi({
                            'name': 'sellerRemark',
                            'remark': sellerRemark
                        })
                    } else if (orderListVm.modalForm.type == 9) {
                        const addressId = orderListVm.modalForm.refundAddress;
                        if (!addressId) return $.alert('请选择退货地址');
                        this.returnHandleApi({
                            serialNumber: this.modalForm.row?.order_return
                                ?.serial_number,
                            addressId
                        }, 'selectAddress')
                    } else if (orderListVm.modalForm.type == 10) {
                        const type = orderListVm.modalForm.refundType;
                        const refundMoney = orderListVm.modalForm.refundMoney;
                        if (type === '') return $.alert('请选择退款类型');
                        if (type == 0 && !refundMoney) return $.alert('请输入退款金额');
                        const params = {
                            serialNumber: this.modalForm.row?.order_return?.serial_number,
                            price: parseFloat(refundMoney),
                            refundType: type,
                            status: 2
                        }
                        if (type == 1) delete params.price
                        this.returnHandleApi(params, 'refundAudit')
                    } else {
                        $('#seller-order-modal').modal('hide');
                    }
                },
                tableHandleApi(params) {
                    ajaxPostFunc('/admin/ajax/action', {
                        '_token': LA.token,
                        'table': 'shopOrder',
                        'primaryKey': orderListVm.modalForm.row.order_id,
                        ...params
                    }, {}, res => {
                        orderListVm.getList()
                        $('#seller-order-modal').modal('hide');
                    })
                },
                returnHandleApi(params, type) {
                    if (type == 'selectAddress') {
                        ajaxPostFunc('/v1/api/productOrderReturn/agreeRefundProduct', {
                            ...params
                        }, {
                            'newAuth': newAuth
                        }, res => {
                            orderListVm.getList()
                            $('#seller-order-modal').modal('hide');
                        })
                    } else if (type == 'refundAudit') {
                        ajaxPostFunc('/v1/api/productOrderReturn/audit', {
                            ...params
                        }, {
                            'newAuth': newAuth
                        }, res => {
                            orderListVm.getList()
                            $('#seller-order-modal').modal('hide');
                        })
                    } else if (type == 'cancelRefund') {
                        ajaxPostFunc('/v1/api/productOrderReturn/cancelRefundProduct', {
                            ...params
                        }, {
                            'newAuth': newAuth
                        }, res => {
                            orderListVm.getList()
                            $('#seller-order-modal').modal('hide');
                        })
                    }
                }
            },
            mounted() {
                setTimeout(() => {
                    orderListVm.getTJ()
                    orderListVm.getList('change')
                })
            }
        })
    })
</script>

<style scoped>
    #shopOrderList {
        background-color: #fff;
    }

    .order-top-view {
        display: flex;
        align-items: center;
        padding: 15px;
    }

    .ycxq-tabs {
        margin-left: 15px;
    }

    .detail-msg-item {
        display: flex;
        margin-bottom: 10px;
        font-size: 16px;
    }

    .detail-msg-item span:nth-child(1) {
        width: 120px;
        text-align: right;
    }

    .detail-msg-item span:nth-child(2) {
        flex: 1;
        margin-left: 15px;
    }

    .el-input__inner {
        border-radius: 0 !important;
    }

    .search-form {
        padding: 5px 15px 15px;
    }

    .order-form-inline .el-input {
        width: 200px;
    }
</style>
